package com.liziba.classloader;


import com.liziba.classloader.bean.Person;

/**
 * <p>
 *      测试文件类加载器
 * </p>
 *
 * @Author: Liziba
 * @Date: 2021/5/31 23:12
 */
public class TestFileSystemClassLoader {

    public static void main(String[] args) {

        String rootDir = "E:\\workspaceall\\liziba-javap5\\out\\production\\liziba-javap5";
        String className = "com.liziba.classloader.bean.Person";
        FileSystemClassLoader fscl = new FileSystemClassLoader(rootDir);
        Class<?> clazz = null;
        try {
            clazz = fscl.findClass(className);
            Object object = clazz.newInstance();
            System.out.println(object);
            System.out.println(object.getClass().getClassLoader());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }

    }
}
